<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <link rel="stylesheet" type="text/css" href="./css/aui.css" />
    <link rel="stylesheet" type="text/css" href="./css/style.css" />
    <link rel="stylesheet" type="text/css" href="./css/font-awesome.min.css" />
    <script type="text/javascript" src="./script/jquery.min.js"></script>
    <link class="theme" rel="stylesheet" type="text/css" href="./css/color/blue.css" />
    <script type="text/javascript" src="./script/doT.min.js"></script>

</head>

<body>
    <header class="aui-bar aui-bar-nav header">
        <a class="aui-pull-left">
            <span class="aui-iconfont aui-icon-left" onclick="closeWin()"></span>
        </a>
        <div class="aui-title"><span>市管领导干部信息查询系统--条件查询</span></div>
        <a class="aui-pull-right aui-btn">
            <!-- <span class="fa fa-user-circle-o"></span> -->
        </a>
    </header>
    <div class="header-d"></div>

    <!-- 分类 -->
    <!-- <div class="list-t">
        <img src="images/cover_logo.png">
        <span>中共佳木斯市委组织部</span>
    </div> -->
    <div id="list">
    </div>
    <script type='text/template' id='template'>
        <div class="classify-img">
            <ul>
                {{~it :value:index}}
                {{? value==0}}
                <h2 class="classify-no">无查询结果</h2>
                {{??}}

                <li onclick="click_in({{=value.userID}})">
                    <img src="file:///storage/emulated/0/ader/pic/{{=value.userID}}.jpg">
                    <dl>
                        <dt>{{=value.I01}}</dt>
                        <dd>{{=value.I16}}</dd>
                    </dl>
                </li>
                {{?}}
                {{~}}
            </ul>
        </div>
    </script>


    <!-- 改变模板颜色 -->
    <!-- <div class="theme-x">
        <ul>
            <li class="theme-blue"></li>
            <li class="theme-red"></li>
            <li class="theme-green"></li>
            <li class="theme-orange"></li>
        </ul>
    </div> -->
    <script>
        $(".theme-blue").on("click", function() {
            $(".theme").attr("href", "./css/color/blue.css")
            $api.setStorage('color', './css/color/blue.css');
        });
        $(".theme-red").on("click", function() {
            $(".theme").attr("href", "./css/color/red.css")
            $api.setStorage('color', './css/color/red.css');
        });
        $(".theme-green").on("click", function() {
            $(".theme").attr("href", "./css/color/green.css")
            $api.setStorage('color', './css/color/green.css');
        });
        $(".theme-orange").on("click", function() {
            $(".theme").attr("href", "./css/color/orange.css")
            $api.setStorage('color', './css/color/orange.css');
        });
    </script>



    <!--
<footer class="aui-bar aui-bar-tab footer" id="footer">
    <div class="aui-bar-tab-item aui-active" tapmode>
        <i class="fa fa-list-ul"></i>
        <div class="aui-bar-tab-label">分类</div>
    </div>
    <div class="aui-bar-tab-item" tapmode>
        <i class="fa fa-exclamation-circle"></i>
        <div class="aui-bar-tab-label">条件</div>
    </div>
    <div class="aui-bar-tab-item" tapmode>
        <i class="fa fa-calendar"></i>
        <div class="aui-bar-tab-label">方案</div>
    </div>
    <div class="aui-bar-tab-item" tapmode>
        <i class="fa fa-bar-chart"></i>
        <div class="aui-bar-tab-label">统计</div>
    </div>
</footer> -->

</body>
<script type="text/javascript" src="./script/api.js"></script>

</html>
<script>
    function closeWin() {
        // api.execScript({
        //     name: 'index',
        //     script: 'reloadIndex();'
        // });
        api.closeFrame();

    }

    function click_in(index) {
        api.openWin({
            name: 'jianli',
            url: './jianli.html',
            scaleEnabled: true,
            pageParam: {
                id: index
            }
        });
    }

    apiready = function() {

        var color = $api.getStorage('color');
        $(".theme").attr("href", color);

        var sql = api.pageParam.sql;
        var db = api.require('db');

        db.selectSql({
            name: 'data',
            sql: sql
        }, function(ret, err) {
            if (ret.status != false) {
              api.hideProgress();
                title = ret.data;
                if (ret.data=='') {
                  title='0';
                }
                var dotFn = doT.template(template.innerHTML);
                var html = dotFn(title);
                var list = $api.byId('list');
                $api.html(list, html);
            } else {
                alert(JSON.stringify(err));
            }
        });

    }
</script>
